import {mysqlConfig} from '../config';  //引入数据库配置模块中的数据


const mongoose = require('mongoose');
var url = `mongodb://${mysqlConfig.host}:${mysqlConfig.port}/${mysqlConfig.database}`;   //mongo是我的数据库
mongoose.connect(url);
const con = mongoose.connection;
con.on('error', console.error.bind(console, '连接数据库失败'));
con.once('open',()=>{
  console.log("链接成功")
    //成功连接
})



export default con
